<!--<?php
require_once template('header'); 
print <<<EOT
<!--右边开始-->
<script language="JavaScript">
<!--
function Add_region()
{
    var selCountry  = document.forms['mvmmall'].elements['country'];
    var selProvince = document.forms['mvmmall'].elements['province'];
    var selCity     = document.forms['mvmmall'].elements['city'];
    var regionCell  = document.getElementById("region");
    
        if (selCity.selectedIndex > 0)
        {
            regionId = selCity.options[selCity.selectedIndex].value;
            regionName = selCity.options[selCity.selectedIndex].text;
        }
        else
        {
            if (selProvince.selectedIndex > 0)
            {
                regionId = selProvince.options[selProvince.selectedIndex].value;
                regionName = selProvince.options[selProvince.selectedIndex].text;
            }
            else
            {
                 if (selCountry.selectedIndex >= 0)
                {
                    regionId = selCountry.options[selCountry.selectedIndex].value;
                    regionName = selCountry.options[selCountry.selectedIndex].text;
                }
                else
                {
                    return;
                }
            }
        }
    exists = false;
    for (i = 0; i < document.forms['mvmmall'].elements.length; i++)
    {
      if (document.forms['mvmmall'].elements[i].type=="checkbox")
      {
        if (document.forms['mvmmall'].elements[i].value == regionId)
        {
          exists = true;
          alert('选定的地区已经存在');
        }
      }
    }
    if (!exists)
    {
      regionCell.innerHTML += "<input type='checkbox' name='region[]' value='" + regionId + "' checked='true' /> " + regionName + "&nbsp;&nbsp;";
    }
}
//-->
</script>
<div id="right">
	<form name="mvmmall" action="" method="post" onsubmit = "return area();">
	<input type="hidden" name="setp" id="setp" value="1"/>
	<input type="hidden" name="action" id="action" value="$action"/>
	<input type="hidden" name="ship_id" id="ship_id" value="$ship_id"/>
	<input type="hidden" name="area_id" id="area_id" value="$area_id"/>
	<table cellpadding="0" cellspacing="1" class="list1">
		<tr><th colspan="2">$lang[regional_costs]</th>
		</tr>
		<tr >
			<td class="td_left1" width="60%">$lang[regional_title]</td>
			<td><input type="text" name="area_name" id="area_name" value="$area[area_name]" size="30" maxlength="20" class="text" /></td>
		</tr>
<!--
EOT;
foreach ($fields as $val){
print <<<EOT
-->		
		<tr >
			<td class="td_left1">$val[label]</td>
			<td><input type="text" name="$val[name]" id="$val[name]" value="$val[value]" size="30" maxlength="20" class="text" /></td>
		</tr>
<!--
EOT;
} print <<<EOT
-->		
      <tr >
			<td class="td_left1" width="60%">所辖地区</td>
			<td id="region">
<!--
EOT;
foreach ($area['region'] as $val){
print <<<EOT
-->				
			<input type="checkbox" name="region[]" id="region[]" value="$val" checked="true" />$val
<!--
EOT;
} print <<<EOT
-->				
			
			</td>
		</tr>
		<tr >
			<td class="td_left1"></td>
			<td>
			<script src="include/javascript/initcity.js"></script>
			<select id="country" name="country" size="10" style="width:80px;"><option value="全国">全国</option></select>
			<select onchange="initcity();" id="province" name="province" size="10" style="width:80px;">
			<script>creatprovince();</script>
			</select>
			<select id="city" name="city" size="10" style="width:80px"><option value="">选择城市</option></select>
			<input type="button" value="添 加" class="button" onclick="Add_region()" /></td>
		</tr>
	</table>
	<div id="tfoot"><input type="submit" name="Submit" value="&nbsp;$lang[submit]&nbsp;" onclick="" /> <input type="reset" name="reset" value="&nbsp;$lang[reset]&nbsp;" /></div>
	</form>
</div>
<!--
EOT;
?>-->